//
//  MailArray.m
//  MailNotify
//
//  Created by Luke van der Hoeven on 5/15/08.
//  Copyright 2008 Cedarville University. All rights reserved.
//

#import "MailArray.h"

@implementation MailArray

- (id)init {
	self = [super init];
	mailIDs = [[NSMutableArray alloc] init];
	messages = [[NSMutableArray alloc] init];
	menuItems = [[NSMutableArray alloc] init];
	return self;
}

- (void)add:(NSInteger)i obj:(MailMessage*)o {
	[mailIDs addObject:[NSNumber numberWithInt:i]];
	[messages addObject:o];	 
//	[menuItems addObject:menuItem];
}

- (void)remove:(NSInteger)i {
	NSInteger index = [mailIDs indexOfObject:[NSNumber numberWithInt:i]];
	[mailIDs removeObjectAtIndex:index];
	[messages removeObjectAtIndex:index];
}

- (BOOL)isAdded:(NSInteger)i {
	return [mailIDs containsObject:[NSNumber numberWithInt:i]];	
}

- (BOOL)hasTitle:(NSString*)title {
	for(MailMessage *msg in messages) {
		if([msg subject] == title)
			return TRUE;
	}
	return FALSE;
}

- (int)count{
	return [mailIDs count];
}

- (NSArray*) getItems {
	return messages;
}

@end
